
function SSL_AJAX_OBJ(url,posturl,callback,type,failFun,charset){
	//iDebug(url);
	var xmlRequest = null;
        if (window.XMLHttpRequest) { // Mozilla, Safari,...
           xmlRequest = new XMLHttpRequest();
        } else if (window.ActiveXObject) { // IE
            try {
                xmlRequest = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
	xmlRequest.onreadystatechange = function(){
		if(xmlRequest.readyState == 4){
			if(xmlRequest.status == 200||xmlRequest.status == 304){
					callback(xmlRequest);
			}
			else {//if(xmlRequest.status == 404)
					failFun();	
			}
		}
	}
	if(type=="POST"){
		xmlRequest.open("POST", url, true);//"POST"
		//xmlRequest.setRequestHeader("Content-type","text/xml; charset=utf-8"); //php;
		//xmlRequest.setRequestHeader("Content-type","application/json");//java alarm; java answer
		xmlRequest.send(posturl);	
	}
	else if(type=="Get"){
		xmlRequest.open("Get",url,true);
		var re = /<meta.*charset=([^"]+).*?>/i;
		if(charset == "gb2312") xmlRequest.overrideMimeType("text/html;charset=gb2312");
		else  xmlRequest.overrideMimeType("text/html;charset=utf-8");
		xmlRequest.send(null);	
	}
}
function fail(){
	//iDebug("网络异常");
}
function backFun(xmlRequest){
	if(xmlRequest!=""){
		//iDebug("callback="+xmlRequest.responseText);
	}
}
function shouSL(){ 
	var DateTemp = new Date();
	var day = DateTemp.getFullYear() + "-" + parseInt(DateTemp.getMonth() + 1) + "-" + DateTemp.getDate();
	var h = DateTemp.getHours().toString().length == 1?"0"+DateTemp.getHours():DateTemp.getHours();
	var m = DateTemp.getMinutes().toString().length == 1?"0"+DateTemp.getMinutes():DateTemp.getMinutes();
	var s = DateTemp.getSeconds().toString().length == 1?"0"+DateTemp.getSeconds():DateTemp.getSeconds();
	var et = h +""+ m +""+ s;
	var doUrl =  "http://10.65.255.119:8080/ars_collect?collect_xml="; 
	//if(location.href.indexOf("RamadaHotel2/index.html")>-1)
		doUrl =doUrl +  '<item ca="' + hardware.STB.serialNumber + '" type="portal" collect_object="2" portal_id="1" portal_column_id="308" time="'+et+'" finished_flag="1" area_code="' + VOD.server.nodeGroupId + '" name="ShuangJiDaTi"/>';

	/*else if(location.href.indexOf("shce/xwdt/index.htm")>-1)
		doUrl =doUrl +  '<item ca="' + hardware.STB.serialNumber + '" type="app" collect_object="4" app_id="38" app_column_id="1" time="'+et+'" finished_flag="1" area_code="' + VOD.server.nodeGroupId + '" name="扫黑除恶>新闻动态"/>';

	else if(location.href.indexOf("shce/zsjt/index.htm")>-1)
		doUrl =doUrl +  '<item ca="' + hardware.STB.serialNumber + '" type="app" collect_object="4" app_id="38" app_column_id="2" time="'+et+'" finished_flag="1" area_code="' + VOD.server.nodeGroupId + '" name="扫黑除恶>知识讲堂"/>';	

	else if(location.href.indexOf("shce/dxal/index.htm")>-1)
		doUrl =doUrl +  '<item ca="' + hardware.STB.serialNumber + '" type="app" collect_object="4" app_id="38" app_column_id="3" time="'+et+'" finished_flag="1" area_code="' + VOD.server.nodeGroupId + '" name="扫黑除恶>典型案例"/>';	

	else if(location.href.indexOf("shce/content.htm")>-1)
	    doUrl =doUrl +  '<item ca="' + hardware.STB.serialNumber + '" type="app" collect_object="4" app_id="38" app_column_id="4" time="'+et+'" finished_flag="1" area_code="' + VOD.server.nodeGroupId + '" name="扫黑除恶>举报途径"/>';*/
	
	SSL_AJAX_OBJ(doUrl ,"",function(xmlRequest){},"Get",fail,"utf-8");	
}
function addLoadEvent(func){ 
    var oldonload = window.onload; 
    if(typeof window.onload!='function'){ //object
	   func();
    }else{ 
        window.onload=function(){ 
            oldonload(); 
            func(); 
        } 
    } 
} 
addLoadEvent(shouSL); //this must at the end.
